﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Linq;
using FuelTracker.Models;
using Caliburn.Micro;
using FuelTracker.Services;
using System.Windows.Navigation;
using FuelTracker.ViewModels;
using FuelTracker.Resources;


namespace FuelTracker.DesignTimeData
{
    public class MainDesignTimeViewModel
    {
        private Vehicle lastVehicle;

        private Vehicle selectedVehicle;
        public Vehicle SelectedVehicle
        {
            get { return selectedVehicle; }
            set
            {
                if (selectedVehicle != value)
                {
                    selectedVehicle = value;
                }
            }
        }

        private ObservableCollection<FuelLogViewModel> lastFuelLogs = new ObservableCollection<FuelLogViewModel>();
        public ObservableCollection<FuelLogViewModel> LastFuelLogs
        {
            get { return lastFuelLogs;  }
        }

        private List<Vehicle> vehicles;
        public List<Vehicle> Vehicles
        {
            get { return vehicles; }
        }

        public bool IsLoading
        {
            get { return true; }
        }

        public MainDesignTimeViewModel()
        {
            vehicles = new List<Vehicle>
            {
                new Vehicle("Vehicle 1")
                {
                    FuelLogs = new List<FuelLog>
                    {
                        new FuelLog(DateTime.Now.AddDays(-1), 500, 70, 100),
                        new FuelLog(DateTime.Now.AddDays(-2), 490, 71, 95.5M)
                    }
                },
                new Vehicle("Vehicle 2")
                {
                    FuelLogs = new List<FuelLog>
                    {
                        new FuelLog(DateTime.Now.AddDays(-1), 500, 70, 100),
                        new FuelLog(DateTime.Now.AddDays(-2), 490, 71, 95.5M)
                    }
                }
            };
            lastVehicle = vehicles.First();

            
            foreach (FuelLog fuelLog in lastVehicle.FuelLogs)
            {
                lastFuelLogs.Add(new FuelLogViewModel(fuelLog));
            }
        }
         
       

        #region Lokalization

        public String LabelApplicationTitle
        {
            get { return Texts.Lbl_ApplicationTitle; }
        }

        public String LabelRecent
        {
            get { return Texts.Lbl_Recent; }
        }

        public String LabelVehicles
        {
            get { return Texts.Lbl_Vehicles; }
        }

        public String LabelLoading
        {
            get { return Texts.Loading; }
        }

        #endregion
    }
}